/* Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.*/
(function(a){function b(a){return a&&a.Object===Object?a:null}function c(a){for(var b=a.length,c=new Array(b),d=0;b>d;d++)c[d]=a[d];return c}function d(a){return function(){try{return a.apply(this,arguments)}catch(b){return la.e=b,la}}}function e(a){throw a}function f(a,b){if(na&&b.stack&&"object"==typeof a&&null!==a&&a.stack&&-1===a.stack.indexOf(ra)){for(var c=[],d=b;d;d=d.source)d.stack&&c.unshift(d.stack);c.unshift(a.stack);var e=c.join("\n"+ra+"\n");a.stack=g(e)}}function g(a){for(var b=a.split("\n"),c=[],d=0,e=b.length;e>d;d++){var f=b[d];h(f)||i(f)||!f||c.push(f)}return c.join("\n")}function h(a){var b=k(a);if(!b)return!1;var c=b[0],d=b[1];return c===pa&&d>=qa&&fe>=d}function i(a){return-1!==a.indexOf("(module.js:")||-1!==a.indexOf("(node.js:")}function j(){if(na)try{throw new Error}catch(a){var b=a.stack.split("\n"),c=b[0].indexOf("@")>0?b[1]:b[2],d=k(c);if(!d)return;return pa=d[0],d[1]}}function k(a){var b=/at .+ \((.+):(\d+):(?:\d+)\)$/.exec(a);if(b)return[b[1],Number(b[2])];var c=/at ([^ ]+):(\d+):(?:\d+)$/.exec(a);if(c)return[c[1],Number(c[2])];var d=/.*@(.+):(\d+)$/.exec(a);return d?[d[1],Number(d[2])]:void 0}function l(b,c,d,e,f,g){var h=lb(b),i=h.length,j=lb(c),k=j.length;if(i!==k&&!e)return!1;for(var l,m=i;m--;)if(l=h[m],!(e?l in c:ib.call(c,l)))return!1;for(var n=e;++m<i;){l=h[m];var o,p=b[l],q=c[l];if(!(o===a?d(p,q,e,f,g):o))return!1;n||(n="constructor"===l)}if(!n){var r=b.constructor,s=c.constructor;if(r!==s&&"constructor"in b&&"constructor"in c&&!("function"==typeof r&&r instanceof r&&"function"==typeof s&&s instanceof s))return!1}return!0}function m(a,b,c){switch(c){case Na:case Oa:return+a===+b;case Pa:return a.name===b.name&&a.message===b.message;case Sa:return a!==+a?b!==+b:a===+b;case Ua:case Wa:return a===b+""}return!1}function n(a){return!!a&&"object"==typeof a}function o(a){return"number"==typeof a&&a>-1&&a%1===0&&kb>=a}function p(a){return n(a)&&o(a.length)&&!!gb[jb.call(a)]}function q(a,b){for(var c=-1,d=a.length;++c<d;)if(b(a[c],c,a))return!0;return!1}function r(b,c,d,e,f,g){var h=-1,i=b.length,j=c.length;if(i!==j&&!(e&&j>i))return!1;for(;++h<i;){var k,l=b[h],m=c[h];if(k!==a){if(k)continue;return!1}if(e){if(!q(c,function(a){return l===a||d(l,a,e,f,g)}))return!1}else if(l!==m&&!d(l,m,e,f,g))return!1}return!0}function s(a,b,c,d,e,f){var g=ob(a),h=ob(b),i=Ma,j=Ma;g||(i=jb.call(a),i===La?i=Ta:i!==Ta&&(g=p(a))),h||(j=jb.call(b),j===La&&(j=Ta));var k=i===Ta&&!nb(a),n=j===Ta&&!nb(b),o=i===j;if(o&&!g&&!k)return m(a,b,i);if(!d){var q=k&&ib.call(a,"__wrapped__"),s=n&&ib.call(b,"__wrapped__");if(q||s)return c(q?a.value():a,s?b.value():b,d,e,f)}if(!o)return!1;e||(e=[]),f||(f=[]);for(var t=e.length;t--;)if(e[t]===a)return f[t]===b;e.push(a),f.push(b);var u=(g?r:l)(a,b,c,d,e,f);return e.pop(),f.pop(),u}function t(a,b,c,d,e){return a===b?!0:null==a||null==b||!mb(a)&&!n(b)?a!==a&&b!==b:s(a,b,t,c,d,e)}function u(a,b){for(var c=new Array(a),d=0;a>d;d++)c[d]=b();return c}function v(a,b){this.scheduler=a,this.disposable=b,this.isDisposed=!1}function w(a,b){b.isDisposed||(b.isDisposed=!0,b.disposable.dispose())}function x(a,b){this.id=a,this.value=b}function y(a){this._s=a,this.isDisposed=!1}function z(a){this._s=a}function A(a){this._s=a,this._l=a.length,this._i=0}function B(a){this._a=a}function C(a){this._a=a,this._l=G(a),this._i=0}function D(a){return"number"==typeof a&&ba.isFinite(a)}function E(b){var c,d=b[Ea];if(!d&&"string"==typeof b)return c=new z(b),c[Ea]();if(!d&&b.length!==a)return c=new B(b),c[Ea]();if(!d)throw new TypeError("Object is not iterable");return b[Ea]()}function F(a){var b=+a;return 0===b?b:isNaN(b)?b:0>b?-1:1}function G(a){var b=+a.length;return isNaN(b)?0:0!==b&&D(b)?(b=F(b)*Math.floor(Math.abs(b)),0>=b?0:b>Fc?Fc:b):b}function H(a,b){return Jb(a)||(a=Pb),new Hc(b,a)}function I(a,b){this.observer=a,this.parent=b}function J(a,b){return a.amb(b)}function K(){return!1}function L(){for(var a=arguments.length,b=new Array(a),c=0;a>c;c++)b[c]=arguments[c];return b}function K(){return!1}function L(){for(var a=arguments.length,b=new Array(a),c=0;a>c;c++)b[c]=arguments[c];return b}function K(){return!1}function M(){return[]}function K(){return!1}function M(){return[]}function L(){for(var a=arguments.length,b=new Array(a),c=0;a>c;c++)b[c]=arguments[c];return b}function N(a){return function(b){return a.subscribe(b)}}function O(a){return a.toArray()}function P(a){return a.length>0}function Q(a){return{"@@iterator":function(){return{next:function(){return{done:!1,value:a}}}}}}function Q(a){return{"@@iterator":function(){return{next:function(){return{done:!1,value:a}}}}}}function R(a,b,c){for(var d=0,e=a.length;e>d;d++)if(c(a[d],b))return d;return-1}function S(a){this.comparer=a,this.set=[]}function T(b,c){return function(d){for(var e=d,f=0;c>f;f++){var g=e[b[f]];if("undefined"==typeof g)return a;e=g}return e}}function U(a){return{"@@transducer/init":function(){return a},"@@transducer/step":function(a,b){return a.onNext(b)},"@@transducer/result":function(a){return a.onCompleted()}}}var V={"function":!0,object:!0},W=V[typeof exports]&&exports&&!exports.nodeType?exports:null,X=V[typeof module]&&module&&!module.nodeType?module:null,Y=b(W&&X&&"object"==typeof global&&global),Z=b(V[typeof self]&&self),$=b(V[typeof window]&&window),_=X&&X.exports===W?W:null,aa=b(V[typeof this]&&this),ba=Y||$!==(aa&&aa.window)&&$||Z||aa||Function("return this")(),ca={internals:{},config:{Promise:ba.Promise},helpers:{}},da=ca.helpers.noop=function(){},ea=ca.helpers.identity=function(a){return a},fa=ca.helpers.defaultNow=function(){return Date.now?Date.now:function(){return+new Date}}(),ga=ca.helpers.defaultComparer=function(a,b){return pb(a,b)},ha=ca.helpers.defaultSubComparer=function(a,b){return a>b?1:b>a?-1:0},ia=(ca.helpers.defaultKeySerializer=function(a){return a.toString()},ca.helpers.defaultError=function(a){throw a}),ja=ca.helpers.isPromise=function(a){return!!a&&"function"!=typeof a.subscribe&&"function"==typeof a.then},ka=ca.helpers.isFunction=function(){var a=function(a){return"function"==typeof a||!1};return a(/x/)&&(a=function(a){return"function"==typeof a&&"[object Function]"==sa.call(a)}),a}(),la={e:{}},ma=ca.internals.tryCatch=function(a){if(!ka(a))throw new TypeError("fn must be a function");return d(a)};ca.config.longStackSupport=!1;var na=!1,oa=ma(function(){throw new Error})();na=!!oa.e&&!!oa.e.stack;var pa,qa=j(),ra="From previous event:",sa=Object.prototype.toString,ta="[object Array]",ua="[object Function]",va="[object String]";Array.prototype.forEach||(Array.prototype.forEach=function(a,b){var c,d;if(null==this)throw new TypeError(" this is null or not defined");var e=Object(this),f=e.length>>>0;if("function"!=typeof a)throw new TypeError(a+" is not a function");for(arguments.length>1&&(c=b),d=0;f>d;){var g;d in e&&(g=e[d],a.call(c,g,d,e)),d++}});var wa=Object("a"),xa="a"!==wa[0]||!(0 in wa);Array.prototype.every||(Array.prototype.every=function(a){var b=Object(this),c=xa&&sa.call(this)===va?this.split(""):b,d=c.length>>>0,e=arguments[1];if(sa.call(a)!==ua)throw new TypeError(a+" is not a function");for(var f=0;d>f;f++)if(f in c&&!a.call(e,c[f],f,b))return!1;return!0}),Array.prototype.map||(Array.prototype.map=function(a){var b=Object(this),c=xa&&sa.call(this)===va?this.split(""):b,d=c.length>>>0,e=new Array(d),f=arguments[1];if(sa.call(a)!==ua)throw new TypeError(a+" is not a function");for(var g=0;d>g;g++)g in c&&(e[g]=a.call(f,c[g],g,b));return e}),Array.prototype.filter||(Array.prototype.filter=function(a){for(var b,c=[],d=new Object(this),e=0,f=d.length>>>0;f>e;e++)b=d[e],e in d&&a.call(arguments[1],b,e,d)&&c.push(b);return c}),Array.isArray||(Array.isArray=function(a){return sa.call(a)===ta}),Array.prototype.indexOf||(Array.prototype.indexOf=function(a){var b=Object(this),c=b.length>>>0;if(0===c)return-1;var d=0;if(arguments.length>1&&(d=Number(arguments[1]),d!==d?d=0:0!==d&&d!==1/0&&d!==-(1/0)&&(d=(d>0||-1)*Math.floor(Math.abs(d)))),d>=c)return-1;for(var e=d>=0?d:Math.max(c-Math.abs(d),0);c>e;e++)if(e in b&&b[e]===a)return e;return-1}),Object.prototype.propertyIsEnumerable||(Object.prototype.propertyIsEnumerable=function(a){for(var b in this)if(b===a)return!0;return!1}),Object.keys||(Object.keys=function(){"use strict";var a=Object.prototype.hasOwnProperty,b=!{toString:null}.propertyIsEnumerable("toString");return function(c){if("object"!=typeof c&&("function"!=typeof c||null===c))throw new TypeError("Object.keys called on non-object");var d,e,f=[];for(d in c)a.call(c,d)&&f.push(d);if(b)for(e=0;Ka>e;e++)a.call(c,Ja[e])&&f.push(Ja[e]);return f}}()),"function"!=typeof Object.create&&(Object.create=function(){function a(){}var b=Object.prototype.hasOwnProperty;return function(c){if("object"!=typeof c)throw new TypeError("Object prototype may only be an Object or null");a.prototype=c;var d=new a;if(a.prototype=null,arguments.length>1){var e=Object(arguments[1]);for(var f in e)b.call(e,f)&&(d[f]=e[f])}return d}}()),ba.Element&&ba.Element.prototype.attachEvent&&!ba.Element.prototype.addEventListener&&function(){function a(a,b){Window.prototype[a]=HTMLDocument.prototype[a]=Element.prototype[a]=b}function b(){b.interval&&document.body&&(b.interval=clearInterval(b.interval),document.dispatchEvent(new CustomEvent("DOMContentLoaded")))}a("addEventListener",function(a,b){var c=this,d=c._c1_listeners=c._c1_listeners||{},e=d[a]=d[a]||[];c.attachEvent("on"+a,e.event=function(a){a||(a=ba.event);var b=c.document&&c.document.documentElement||c.documentElement||{scrollLeft:0,scrollTop:0};switch(a.currentTarget=c,a.pageX=a.clientX+b.scrollLeft,a.pageY=a.clientY+b.scrollTop,a.preventDefault=function(){if(a.bubbledKeyCode=a.keyCode,a.ctrlKey)try{a.keyCode=0}catch(a){}a.defaultPrevented=!0,a.returnValue=!1,a.modified=!0,a.returnValue=!1},a.stopImmediatePropagation=function(){k=!1,a.cancelBubble=!0},a.stopPropagation=function(){a.cancelBubble=!0},a.relatedTarget=a.fromElement||null,a.target=a.srcElement||c,a.timeStamp=+new Date,a.type){case"keypress":var d="charCode"in a?a.charCode:a.keyCode;10===d?(d=0,a.keyCode=13):13===d||27===d?d=0:3===d&&(d=99),a.charCode=d,a.keyChar=a.charCode?String.fromCharCode(a.charCode):""}var f={};for(var g in a)f[g]=a[g];for(var h,i=0,j=[].concat(e),k=!0;k&&(h=j[i]);++i)for(var l,m=0;l=e[m];++m)if(l===h){l.call(c,f);break}}),e.push(b)}),a("removeEventListener",function(a,b){for(var c,d=this,e=d._c1_listeners=d._c1_listeners||{},f=e[a]=e[a]||[],g=f.length-1;c=f[g];--g)if(c===b){f.splice(g,1);break}!f.length&&f.event&&d.detachEvent("on"+a,f.event)}),a("dispatchEvent",function(a){var b=this,c=a.type,d=b._c1_listeners=b._c1_listeners||{},e=d[c]=d[c]||[];try{return b.fireEvent("on"+c,a)}catch(f){return e.event&&e.event(a)}}),b.interval=setInterval(b,1),ba.addEventListener("load",b)}(),(!ba.CustomEvent||"object"==typeof ba.CustomEvent)&&function(){function b(b,c){var d;c=c||{bubbles:!1,cancelable:!1,detail:a};try{document.createEvent?(d=document.createEvent("CustomEvent"),d.initCustomEvent(b,c.bubbles,c.cancelable,c.detail)):document.createEventObject&&(d=document.createEventObject())}catch(e){d=document.createEvent("Event"),d.initEvent(b,c.bubbles,c.cancelable),d.detail=c.detail}return d}ba.CustomEvent&&(b.prototype=ba.CustomEvent.prototype),ba.CustomEvent=b}();var ya=ca.EmptyError=function(){this.message="Sequence contains no elements.",Error.call(this)};ya.prototype=Object.create(Error.prototype),ya.prototype.name="EmptyError";var za=ca.ObjectDisposedError=function(){this.message="Object has been disposed",Error.call(this)};za.prototype=Object.create(Error.prototype),za.prototype.name="ObjectDisposedError";var Aa=ca.ArgumentOutOfRangeError=function(){this.message="Argument out of range",Error.call(this)};Aa.prototype=Object.create(Error.prototype),Aa.prototype.name="ArgumentOutOfRangeError";var Ba=ca.NotSupportedError=function(a){this.message=a||"This operation is not supported",Error.call(this)};Ba.prototype=Object.create(Error.prototype),Ba.prototype.name="NotSupportedError";var Ca=ca.NotImplementedError=function(a){this.message=a||"This operation is not implemented",Error.call(this)};Ca.prototype=Object.create(Error.prototype),Ca.prototype.name="NotImplementedError";var Da=ca.helpers.notImplemented=function(){throw new Ca},Ea=(ca.helpers.notSupported=function(){throw new Ba},"function"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_");ba.Set&&"function"==typeof(new ba.Set)["@@iterator"]&&(Ea="@@iterator");var Fa=ca.doneEnumerator={done:!0,value:a},Ga=ca.helpers.isIterable=function(b){return b&&b[Ea]!==a},Ha=ca.helpers.isArrayLike=function(b){return b&&b.length!==a};ca.helpers.iterator=Ea;var Ia=ca.internals.bindCallback=function(a,b,c){if("undefined"==typeof b)return a;switch(c){case 0:return function(){return a.call(b)};case 1:return function(c){return a.call(b,c)};case 2:return function(c,d){return a.call(b,c,d)};case 3:return function(c,d,e){return a.call(b,c,d,e)}}return function(){return a.apply(b,arguments)}},Ja=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],Ka=Ja.length,La="[object Arguments]",Ma="[object Array]",Na="[object Boolean]",Oa="[object Date]",Pa="[object Error]",Qa="[object Function]",Ra="[object Map]",Sa="[object Number]",Ta="[object Object]",Ua="[object RegExp]",Va="[object Set]",Wa="[object String]",Xa="[object WeakMap]",Ya="[object ArrayBuffer]",Za="[object Float32Array]",$a="[object Float64Array]",_a="[object Int8Array]",ab="[object Int16Array]",bb="[object Int32Array]",cb="[object Uint8Array]",db="[object Uint8ClampedArray]",eb="[object Uint16Array]",fb="[object Uint32Array]",gb={};gb[Za]=gb[$a]=gb[_a]=gb[ab]=gb[bb]=gb[cb]=gb[db]=gb[eb]=gb[fb]=!0,gb[La]=gb[Ma]=gb[Ya]=gb[Na]=gb[Oa]=gb[Pa]=gb[Qa]=gb[Ra]=gb[Sa]=gb[Ta]=gb[Ua]=gb[Va]=gb[Wa]=gb[Xa]=!1;var hb=Object.prototype,ib=hb.hasOwnProperty,jb=hb.toString,kb=Math.pow(2,53)-1,lb=Object.keys||function(){var a=Object.prototype.hasOwnProperty,b=!{toString:null}.propertyIsEnumerable("toString"),c=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],d=c.length;return function(e){if("object"!=typeof e&&("function"!=typeof e||null===e))throw new TypeError("Object.keys called on non-object");var f,g,h=[];for(f in e)a.call(e,f)&&h.push(f);if(b)for(g=0;d>g;g++)a.call(e,c[g])&&h.push(c[g]);return h}}(),mb=ca.internals.isObject=function(a){var b=typeof a;return!!a&&("object"===b||"function"===b)},nb=function(){try{Object({toString:0}+"")}catch(a){return function(){return!1}}return function(a){return"function"!=typeof a.toString&&"string"==typeof(a+"")}}(),ob=Array.isArray||function(a){return n(a)&&o(a.length)&&jb.call(a)===Ma},pb=ca.internals.isEqual=function(a,b){return t(a,b)},qb=({}.hasOwnProperty,Array.prototype.slice,ca.internals.inherits=function(a,b){function c(){this.constructor=a}c.prototype=b.prototype,a.prototype=new c}),rb=ca.internals.addProperties=function(a){for(var b=[],c=1,d=arguments.length;d>c;c++)b.push(arguments[c]);for(var e=0,f=b.length;f>e;e++){var g=b[e];for(var h in g)a[h]=g[h]}},sb=ca.internals.addRef=function(a,b){return new ae(function(c){return new Db(b.getDisposable(),a.subscribe(c))})},tb=ca.CompositeDisposable=function(){var a,b,c=[];if(Array.isArray(arguments[0]))c=arguments[0];else for(b=arguments.length,c=new Array(b),a=0;b>a;a++)c[a]=arguments[a];this.disposables=c,this.isDisposed=!1,this.length=c.length},ub=tb.prototype;ub.add=function(a){this.isDisposed?a.dispose():(this.disposables.push(a),this.length++)},ub.remove=function(a){var b=!1;if(!this.isDisposed){var c=this.disposables.indexOf(a);-1!==c&&(b=!0,this.disposables.splice(c,1),this.length--,a.dispose())}return b},ub.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;for(var a=this.disposables.length,b=new Array(a),c=0;a>c;c++)b[c]=this.disposables[c];for(this.disposables=[],this.length=0,c=0;a>c;c++)b[c].dispose()}};var vb=ca.Disposable=function(a){this.isDisposed=!1,this.action=a||da};vb.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var wb=vb.create=function(a){return new vb(a)},xb=vb.empty={dispose:da},yb=vb.isDisposable=function(a){return a&&ka(a.dispose)},zb=vb.checkDisposed=function(a){if(a.isDisposed)throw new za},Ab=vb._fixup=function(a){return yb(a)?a:xb},Bb=ca.SingleAssignmentDisposable=function(){this.isDisposed=!1,this.current=null};Bb.prototype.getDisposable=function(){return this.current},Bb.prototype.setDisposable=function(a){if(this.current)throw new Error("Disposable has already been assigned");var b=this.isDisposed;!b&&(this.current=a),b&&a&&a.dispose()},Bb.prototype.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var a=this.current;this.current=null,a&&a.dispose()}};var Cb=ca.SerialDisposable=function(){this.isDisposed=!1,this.current=null};Cb.prototype.getDisposable=function(){return this.current},Cb.prototype.setDisposable=function(a){var b=this.isDisposed;if(!b){var c=this.current;this.current=a}c&&c.dispose(),b&&a&&a.dispose()},Cb.prototype.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var a=this.current;this.current=null}a&&a.dispose()};var Db=ca.BinaryDisposable=function(a,b){this._first=a,this._second=b,this.isDisposed=!1};Db.prototype.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var a=this._first;this._first=null,a&&a.dispose();var b=this._second;this._second=null,b&&b.dispose()}};var Eb=ca.NAryDisposable=function(a){this._disposables=a,this.isDisposed=!1};Eb.prototype.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;for(var a=0,b=this._disposables.length;b>a;a++)this._disposables[a].dispose();this._disposables.length=0}};var Fb=ca.RefCountDisposable=function(){function a(a){this.disposable=a,this.disposable.count++,this.isInnerDisposed=!1}function b(a){this.underlyingDisposable=a,this.isDisposed=!1,this.isPrimaryDisposed=!1,this.count=0}return a.prototype.dispose=function(){this.disposable.isDisposed||this.isInnerDisposed||(this.isInnerDisposed=!0,this.disposable.count--,0===this.disposable.count&&this.disposable.isPrimaryDisposed&&(this.disposable.isDisposed=!0,this.disposable.underlyingDisposable.dispose()))},b.prototype.dispose=function(){this.isDisposed||this.isPrimaryDisposed||(this.isPrimaryDisposed=!0,0===this.count&&(this.isDisposed=!0,this.underlyingDisposable.dispose()))},b.prototype.getDisposable=function(){return this.isDisposed?xb:new a(this)},b}();v.prototype.dispose=function(){this.scheduler.schedule(this,w)};var Gb=ca.internals.ScheduledItem=function(a,b,c,d,e){this.scheduler=a,this.state=b,this.action=c,this.dueTime=d,this.comparer=e||ha,this.disposable=new Bb};Gb.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},Gb.prototype.compareTo=function(a){return this.comparer(this.dueTime,a.dueTime)},Gb.prototype.isCancelled=function(){return this.disposable.isDisposed},Gb.prototype.invokeCore=function(){return Ab(this.action(this.scheduler,this.state))};var Hb=ca.Scheduler=function(){function a(){}a.isScheduler=function(b){return b instanceof a};var b=a.prototype;return b.schedule=function(a,b){throw new Ca},b.scheduleFuture=function(b,c,d){var e=c;return e instanceof Date&&(e-=this.now()),e=a.normalize(e),0===e?this.schedule(b,d):this._scheduleFuture(b,e,d)},b._scheduleFuture=function(a,b,c){throw new Ca},a.now=fa,a.prototype.now=fa,a.normalize=function(a){return 0>a&&(a=0),a},a}(),Ib=Hb.normalize,Jb=Hb.isScheduler;!function(a){function b(a,b){function c(b){function d(a,b){return g?f.remove(i):h=!0,e(b,c),xb}var g=!1,h=!1,i=a.schedule(b,d);h||(f.add(i),g=!0)}var d=b[0],e=b[1],f=new tb;return e(d,c),f}function c(a,b){function c(b,d){function g(a,b){return h?f.remove(j):i=!0,e(b,c),xb}var h=!1,i=!1,j=a.scheduleFuture(b,d,g);i||(f.add(j),h=!0)}var d=b[0],e=b[1],f=new tb;return e(d,c),f}a.scheduleRecursive=function(a,c){return this.schedule([a,c],b)},a.scheduleRecursiveFuture=function(a,b,d){return this.scheduleFuture([a,d],b,c)}}(Hb.prototype),function(a){a.schedulePeriodic=function(a,b,c){if("undefined"==typeof ba.setInterval)throw new Ba;b=Ib(b);var d=a,e=ba.setInterval(function(){d=c(d)},b);return wb(function(){ba.clearInterval(e)})}}(Hb.prototype),function(a){a.catchError=a["catch"]=function(a){return new Vb(this,a)}}(Hb.prototype);var Kb,Lb,Mb=(ca.internals.SchedulePeriodicRecursive=function(){function a(a){return function(b,c){c(0,a._period);var d=ma(a._action)(a._state);d===la&&(a._cancel.dispose(),e(d.e)),a._state=d}}function b(a,b,c,d){this._scheduler=a,this._state=b,this._period=c,this._action=d}return b.prototype.start=function(){var b=new Bb;return this._cancel=b,b.setDisposable(this._scheduler.scheduleRecursiveFuture(0,this._period,a(this))),b},b}(),function(a){function b(){a.call(this)}return qb(b,a),b.prototype.schedule=function(a,b){return Ab(b(this,a))},b}(Hb)),Nb=Hb.immediate=new Mb,Ob=function(a){function b(){for(;d.length>0;){var a=d.dequeue();!a.isCancelled()&&a.invoke()}}function c(){a.call(this)}var d;return qb(c,a),c.prototype.schedule=function(a,c){var f=new Gb(this,a,c,this.now());if(d)d.enqueue(f);else{d=new Wb(4),d.enqueue(f);var g=ma(b)();d=null,g===la&&e(g.e)}return f.disposable},c.prototype.scheduleRequired=function(){return!d},c}(Hb),Pb=Hb.currentThread=new Ob,Qb=function(){var a,b=da;if(ba.setTimeout)a=ba.setTimeout,b=ba.clearTimeout;else{if(!ba.WScript)throw new Ba;a=function(a,b){ba.WScript.Sleep(b),a()}}return{setTimeout:a,clearTimeout:b}}(),Rb=Qb.setTimeout,Sb=Qb.clearTimeout;!function(){function a(b){if(f)Rb(function(){a(b)},0);else{var c=d[b];if(c){f=!0;var g=ma(c)();Lb(b),f=!1,g===la&&e(g.e)}}}function b(){if(!ba.postMessage||ba.importScripts)return!1;var a=!1,b=ba.onmessage;return ba.onmessage=function(){a=!0},ba.postMessage("","*"),ba.onmessage=b,a}var c=1,d={},f=!1;Lb=function(a){delete d[a]};var g=new RegExp("^"+String(sa).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),h="function"==typeof(h=Y&&_&&Y.setImmediate)&&!g.test(h)&&h;if(ka(h))Kb=function(b){var e=c++;return d[e]=b,h(function(){a(e)}),e};else if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))Kb=function(b){var e=c++;return d[e]=b,process.nextTick(function(){a(e)}),e};else if(b()){var i="ms.rx.schedule"+Math.random(),j=function(b){"string"==typeof b.data&&b.data.substring(0,i.length)===i&&a(b.data.substring(i.length))};ba.addEventListener("message",j,!1),Kb=function(a){var b=c++;return d[b]=a,ba.postMessage(i+b,"*"),b}}else if(ba.MessageChannel){var k=new ba.MessageChannel;k.port1.onmessage=function(b){a(b.data)},Kb=function(a){var b=c++;return d[b]=a,k.port2.postMessage(b),b}}else Kb="document"in ba&&"onreadystatechange"in ba.document.createElement("script")?function(b){var e=ba.document.createElement("script"),f=c++;return d[f]=b,e.onreadystatechange=function(){a(f),e.onreadystatechange=null,e.parentNode.removeChild(e),e=null},ba.document.documentElement.appendChild(e),f}:function(b){var e=c++;return d[e]=b,Rb(function(){a(e)},0),e}}();var Tb=function(a){function b(){a.call(this)}function c(a,b,c,d){return function(){a.setDisposable(vb._fixup(b(c,d)))}}function d(a){this._id=a,this.isDisposed=!1}function e(a){this._id=a,this.isDisposed=!1}function f(a,b,c){return function(){b(a,c)}}return qb(b,a),d.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,Lb(this._id))},e.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,Sb(this._id))},b.prototype.schedule=function(a,b){var e=new Bb,f=Kb(c(e,b,this,a));return new Db(e,new d(f))},b.prototype._scheduleFuture=function(a,b,d){if(0===b)return this.schedule(a,d);var f=new Bb,g=Rb(c(f,d,this,a),b);return new Db(f,new e(g))},b.prototype.scheduleLongRunning=function(a,b){var c=wb(da);return Kb(f(a,b,c)),c},b}(Hb),Ub=Hb["default"]=Hb.async=new Tb,Vb=function(a){function b(b,c){this._scheduler=b,this._handler=c,this._recursiveOriginal=null,this._recursiveWrapper=null,a.call(this)}return qb(b,a),b.prototype.schedule=function(a,b){return this._scheduler.schedule(a,this._wrap(b))},b.prototype._scheduleFuture=function(a,b,c){return this._scheduler.schedule(a,b,this._wrap(c))},b.prototype.now=function(){return this._scheduler.now()},b.prototype._clone=function(a){return new b(a,this._handler)},b.prototype._wrap=function(a){var b=this;return function(c,d){var f=ma(a)(b._getRecursiveWrapper(c),d);return f===la?(b._handler(f.e)||e(f.e),xb):Ab(f)}},b.prototype._getRecursiveWrapper=function(a){if(this._recursiveOriginal!==a){this._recursiveOriginal=a;var b=this._clone(a);b._recursiveOriginal=a,b._recursiveWrapper=b,this._recursiveWrapper=b}return this._recursiveWrapper},b.prototype.schedulePeriodic=function(a,b,c){var d=this,f=!1,g=new Bb;return g.setDisposable(this._scheduler.schedulePeriodic(a,b,function(a){if(f)return null;var b=ma(c)(a);return b===la?(f=!0,d._handler(b.e)||e(b.e),g.dispose(),null):b})),g},b}(Hb);x.prototype.compareTo=function(a){var b=this.value.compareTo(a.value);return 0===b&&(b=this.id-a.id),b};var Wb=ca.internals.PriorityQueue=function(a){this.items=new Array(a),this.length=0},Xb=Wb.prototype;Xb.isHigherPriority=function(a,b){return this.items[a].compareTo(this.items[b])<0},Xb.percolate=function(a){if(!(a>=this.length||0>a)){var b=a-1>>1;if(!(0>b||b===a)&&this.isHigherPriority(a,b)){var c=this.items[a];this.items[a]=this.items[b],this.items[b]=c,this.percolate(b)}}},Xb.heapify=function(a){if(+a||(a=0),!(a>=this.length||0>a)){var b=2*a+1,c=2*a+2,d=a;if(b<this.length&&this.isHigherPriority(b,d)&&(d=b),c<this.length&&this.isHigherPriority(c,d)&&(d=c),d!==a){var e=this.items[a];this.items[a]=this.items[d],this.items[d]=e,this.heapify(d)}}},Xb.peek=function(){return this.items[0].value},Xb.removeAt=function(b){this.items[b]=this.items[--this.length],this.items[this.length]=a,this.heapify()},Xb.dequeue=function(){var a=this.peek();return this.removeAt(0),a},Xb.enqueue=function(a){var b=this.length++;this.items[b]=new x(Wb.count++,a),this.percolate(b)},Xb.remove=function(a){for(var b=0;b<this.length;b++)if(this.items[b].value===a)return this.removeAt(b),!0;return!1},Wb.count=0;var Yb=ca.Notification=function(){function a(){}return a.prototype._accept=function(a,b,c){throw new Ca},a.prototype._acceptObserver=function(a,b,c){throw new Ca},a.prototype.accept=function(a,b,c){return a&&"object"==typeof a?this._acceptObserver(a):this._accept(a,b,c)},a.prototype.toObservable=function(a){var b=this;return Jb(a)||(a=Nb),new ae(function(c){return a.schedule(b,function(a,b){b._acceptObserver(c),"N"===b.kind&&c.onCompleted()})})},a}(),Zb=function(a){function b(a){this.value=a,this.kind="N"}return qb(b,a),b.prototype._accept=function(a){return a(this.value)},b.prototype._acceptObserver=function(a){return a.onNext(this.value)},b.prototype.toString=function(){return"OnNext("+this.value+")"},b}(Yb),$b=function(a){function b(a){this.error=a,this.kind="E"}return qb(b,a),b.prototype._accept=function(a,b){return b(this.error)},b.prototype._acceptObserver=function(a){return a.onError(this.error)},b.prototype.toString=function(){return"OnError("+this.error+")"},b}(Yb),_b=function(a){function b(){this.kind="C"}return qb(b,a),b.prototype._accept=function(a,b,c){return c()},b.prototype._acceptObserver=function(a){return a.onCompleted()},b.prototype.toString=function(){return"OnCompleted()"},b}(Yb),ac=Yb.createOnNext=function(a){return new Zb(a)},bc=Yb.createOnError=function(a){return new $b(a)},cc=Yb.createOnCompleted=function(){return new _b},dc=ca.Observer=function(){};dc.prototype.toNotifier=function(){var a=this;return function(b){return b.accept(a)}},dc.prototype.asObserver=function(){var a=this;return new hc(function(b){a.onNext(b)},function(b){a.onError(b)},function(){a.onCompleted()})},dc.prototype.checked=function(){return new ic(this)};var ec=dc.create=function(a,b,c){return a||(a=da),b||(b=ia),c||(c=da),new hc(a,b,c)};dc.fromNotifier=function(a,b){var c=Ia(a,b,1);return new hc(function(a){return c(ac(a))},function(a){return c(bc(a))},function(){return c(cc())})},dc.prototype.notifyOn=function(a){return new kc(a,this)},dc.prototype.makeSafe=function(a){return new AnonymousSafeObserver(this._onNext,this._onError,this._onCompleted,a)};var fc,gc=ca.internals.AbstractObserver=function(a){function b(){this.isStopped=!1}return qb(b,a),b.prototype.next=Da,b.prototype.error=Da,b.prototype.completed=Da,b.prototype.onNext=function(a){!this.isStopped&&this.next(a)},b.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.error(a))},b.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.completed())},b.prototype.dispose=function(){this.isStopped=!0},b.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.error(a),!0)},b}(dc),hc=ca.AnonymousObserver=function(a){function b(b,c,d){a.call(this),this._onNext=b,this._onError=c,this._onCompleted=d}return qb(b,a),b.prototype.next=function(a){this._onNext(a)},b.prototype.error=function(a){this._onError(a)},b.prototype.completed=function(){this._onCompleted()},b}(gc),ic=function(a){function b(b){a.call(this),this._observer=b,this._state=0}qb(b,a);var c=b.prototype;return c.onNext=function(a){this.checkAccess();var b=ma(this._observer.onNext).call(this._observer,a);this._state=0,b===la&&e(b.e)},c.onError=function(a){this.checkAccess();var b=ma(this._observer.onError).call(this._observer,a);this._state=2,b===la&&e(b.e)},c.onCompleted=function(){this.checkAccess();var a=ma(this._observer.onCompleted).call(this._observer);this._state=2,a===la&&e(a.e)},c.checkAccess=function(){if(1===this._state)throw new Error("Re-entrancy detected");if(2===this._state)throw new Error("Observer completed");0===this._state&&(this._state=1)},b}(dc),jc=ca.internals.ScheduledObserver=function(a){function b(b,c){a.call(this),this.scheduler=b,this.observer=c,this.isAcquired=!1,this.hasFaulted=!1,this.queue=[],this.disposable=new Cb}function c(a,b){return function(){a.onNext(b)}}function d(a,b){return function(){a.onError(b)}}function f(a){return function(){a.onCompleted()}}function g(a,b){var c;if(!(a.queue.length>0))return void(a.isAcquired=!1);c=a.queue.shift();var d=ma(c)();return d===la?(a.queue=[],a.hasFaulted=!0,e(d.e)):void b(a)}return qb(b,a),b.prototype.next=function(a){this.queue.push(c(this.observer,a))},b.prototype.error=function(a){this.queue.push(d(this.observer,a))},b.prototype.completed=function(){this.queue.push(f(this.observer))},b.prototype.ensureActive=function(){var a=!1;!this.hasFaulted&&this.queue.length>0&&(a=!this.isAcquired,this.isAcquired=!0),a&&this.disposable.setDisposable(this.scheduler.scheduleRecursive(this,g))},b.prototype.dispose=function(){a.prototype.dispose.call(this),this.disposable.dispose()},b}(gc),kc=function(a){function b(b,c,d){a.call(this,b,c),this._cancel=d}return qb(b,a),b.prototype.next=function(b){a.prototype.next.call(this,b),this.ensureActive()},b.prototype.error=function(b){a.prototype.error.call(this,b),this.ensureActive()},b.prototype.completed=function(){a.prototype.completed.call(this),this.ensureActive()},b.prototype.dispose=function(){a.prototype.dispose.call(this),this._cancel&&this._cancel.dispose(),this._cancel=null},b}(jc),lc=ca.Observable=function(){function a(a,b){return function(c){var d=c.onError;return c.onError=function(b){f(b,a),d.call(c,b)},b.call(a,c)}}function b(){if(ca.config.longStackSupport&&na){var b=this._subscribe,c=ma(e)(new Error).e;this.stack=c.stack.substring(c.stack.indexOf("\n")+1),this._subscribe=a(this,b)}}return fc=b.prototype,b.isObservable=function(a){return a&&ka(a.subscribe)},fc.subscribe=fc.forEach=function(a,b,c){return this._subscribe("object"==typeof a?a:ec(a,b,c))},fc.subscribeOnNext=function(a,b){return this._subscribe(ec("undefined"!=typeof b?function(c){a.call(b,c)}:a))},fc.subscribeOnError=function(a,b){return this._subscribe(ec(null,"undefined"!=typeof b?function(c){a.call(b,c)}:a))},fc.subscribeOnCompleted=function(a,b){return this._subscribe(ec(null,null,"undefined"!=typeof b?function(){a.call(b)}:a))},b}(),mc=ca.ObservableBase=function(a){function b(a){return a&&ka(a.dispose)?a:ka(a)?wb(a):xb}function c(a,c){var d=c[0],f=c[1],g=ma(f.subscribeCore).call(f,d);
g!==la||d.fail(la.e)||e(la.e),d.setDisposable(b(g))}function d(){a.call(this)}return qb(d,a),d.prototype._subscribe=function(a){var b=new be(a),d=[b,this];return Pb.scheduleRequired()?Pb.schedule(d,c):c(null,d),b},d.prototype.subscribeCore=Da,d}(lc),nc=ca.FlatMapObservable=function(a){function b(b,c,d,e){this.resultSelector=ka(d)?d:null,this.selector=Ia(ka(c)?c:function(){return c},e,3),this.source=b,a.call(this)}function c(a,b,c,d){this.i=0,this.selector=b,this.resultSelector=c,this.source=d,this.o=a,gc.call(this)}return qb(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new c(a,this.selector,this.resultSelector,this))},qb(c,gc),c.prototype._wrapResult=function(a,b,c){return this.resultSelector?a.map(function(a,d){return this.resultSelector(b,a,c,d)},this):a},c.prototype.next=function(a){var b=this.i++,c=ma(this.selector)(a,b,this.source);return c===la?this.o.onError(c.e):(ja(c)&&(c=yc(c)),(Ha(c)||Ga(c))&&(c=lc.from(c)),void this.o.onNext(this._wrapResult(c,a,b)))},c.prototype.error=function(a){this.o.onError(a)},c.prototype.completed=function(){this.o.onCompleted()},b}(mc),oc=ca.internals.Enumerable=function(){};y.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,this._s.isDisposed=!0)};var pc=function(a){function b(b){this.sources=b,a.call(this)}function c(a,b){if(!a.isDisposed){var c=ma(a.e.next).call(a.e);if(c===la)return a.o.onError(c.e);if(c.done)return a.o.onCompleted();var e=c.value;ja(e)&&(e=yc(e));var f=new Bb;a.subscription.setDisposable(f),f.setDisposable(e.subscribe(new d(a,b)))}}function d(a,b){this._state=a,this._recurse=b,gc.call(this)}return qb(b,a),b.prototype.subscribeCore=function(a){var b=new Cb,d={isDisposed:!1,o:a,subscription:b,e:this.sources[Ea]()},e=Pb.scheduleRecursive(d,c);return new Eb([b,e,new y(d)])},qb(d,gc),d.prototype.next=function(a){this._state.o.onNext(a)},d.prototype.error=function(a){this._state.o.onError(a)},d.prototype.completed=function(){this._recurse(this._state)},b}(mc);oc.prototype.concat=function(){return new pc(this)};var qc=function(a){function b(b){this.sources=b,a.call(this)}function c(a,b){if(!a.isDisposed){var c=ma(a.e.next).call(a.e);if(c===la)return a.o.onError(c.e);if(c.done)return null!==a.lastError?a.o.onError(a.lastError):a.o.onCompleted();var e=c.value;ja(e)&&(e=yc(e));var f=new Bb;a.subscription.setDisposable(f),f.setDisposable(e.subscribe(new d(a,b)))}}function d(a,b){this._state=a,this._recurse=b,gc.call(this)}return qb(b,a),b.prototype.subscribeCore=function(a){var b=new Cb,d={isDisposed:!1,e:this.sources[Ea](),subscription:b,lastError:null,o:a},e=Pb.scheduleRecursive(d,c);return new Eb([b,e,new y(d)])},qb(d,gc),d.prototype.next=function(a){this._state.o.onNext(a)},d.prototype.error=function(a){this._state.lastError=a,this._recurse(this._state)},d.prototype.completed=function(){this._state.o.onCompleted()},b}(mc);oc.prototype.catchError=function(){return new qc(this)};var rc=function(a){function b(a,b){this.v=a,this.c=null==b?-1:b}function c(a){this.v=a.v,this.l=a.c}return qb(b,a),b.prototype[Ea]=function(){return new c(this)},c.prototype.next=function(){return 0===this.l?Fa:(this.l>0&&this.l--,{done:!1,value:this.v})},b}(oc),sc=oc.repeat=function(a,b){return new rc(a,b)},tc=function(a){function b(a,b,c){this.s=a,this.fn=b?Ia(b,c,3):null}function c(a){this.i=-1,this.s=a.s,this.l=this.s.length,this.fn=a.fn}return qb(b,a),b.prototype[Ea]=function(){return new c(this)},c.prototype.next=function(){return++this.i<this.l?{done:!1,value:this.fn?this.fn(this.s[this.i],this.i,this.s):this.s[this.i]}:Fa},b}(oc),uc=oc.of=function(a,b,c){return new tc(a,b,c)},vc=function(a){function b(b,c){this.source=b,this._s=c,a.call(this)}return qb(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new kc(this._s,a))},b}(mc);fc.observeOn=function(a){return new vc(this,a)};var wc=function(a){function b(b,c){this.source=b,this._s=c,a.call(this)}function c(a,b){var c=b[0],d=b[1],e=b[2];d.setDisposable(new v(a,c.subscribe(e)))}return qb(b,a),b.prototype.subscribeCore=function(a){var b=new Bb,d=new Cb;return d.setDisposable(b),b.setDisposable(this._s.schedule([this.source,d,a],c)),d},b}(mc);fc.subscribeOn=function(a){return new wc(this,a)};var xc=function(a){function b(b,c){this._p=b,this._s=c,a.call(this)}function c(a,b){var c=b[0],d=b[1];c.onNext(d),c.onCompleted()}function d(a,b){var c=b[0],d=b[1];c.onError(d)}return qb(b,a),b.prototype.subscribeCore=function(a){var b=new Bb,e=this,f=this._p;return ka(f)&&(f=ma(f)(),f===la)?(a.onError(f.e),b):(f.then(function(d){b.setDisposable(e._s.schedule([a,d],c))},function(c){b.setDisposable(e._s.schedule([a,c],d))}),b)},b}(mc),yc=lc.fromPromise=function(a,b){return b||(b=Ub),new xc(a,b)};fc.toPromise=function(a){if(a||(a=ca.config.Promise),!a)throw new Ba("Promise type not provided nor in Rx.config.Promise");var b=this;return new a(function(a,c){var d;b.subscribe(function(a){d=a},c,function(){a(d)})})};var zc=function(a){function b(b){this.source=b,a.call(this)}function c(a){this.o=a,this.a=[],gc.call(this)}return qb(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new c(a))},qb(c,gc),c.prototype.next=function(a){this.a.push(a)},c.prototype.error=function(a){this.o.onError(a)},c.prototype.completed=function(){this.o.onNext(this.a),this.o.onCompleted()},b}(mc);fc.toArray=function(){return new zc(this)},lc.create=function(a,b){return new ae(a,b)};var Ac=function(a){function b(b){this._f=b,a.call(this)}return qb(b,a),b.prototype.subscribeCore=function(a){var b=ma(this._f)();return b===la?Sc(b.e).subscribe(a):(ja(b)&&(b=yc(b)),b.subscribe(a))},b}(mc),Bc=(lc.defer=function(a){return new Ac(a)},function(a){function b(b){this.scheduler=b,a.call(this)}function c(a,b){this.observer=a,this.scheduler=b}function d(a,b){return b.onCompleted(),xb}return qb(b,a),b.prototype.subscribeCore=function(a){var b=new c(a,this.scheduler);return b.run()},c.prototype.run=function(){var a=this.observer;return this.scheduler===Nb?d(null,a):this.scheduler.schedule(a,d)},b}(mc)),Cc=new Bc(Nb),Dc=lc.empty=function(a){return Jb(a)||(a=Nb),a===Nb?Cc:new Bc(a)},Ec=function(a){function b(b,c,d){this._iterable=b,this._fn=c,this._scheduler=d,a.call(this)}function c(a,b,c){return function(d,e){var f=ma(b.next).call(b);if(f===la)return a.onError(f.e);if(f.done)return a.onCompleted();var g=f.value;return ka(c)&&(g=ma(c)(g,d),g===la)?a.onError(g.e):(a.onNext(g),void e(d+1))}}return qb(b,a),b.prototype.subscribeCore=function(a){var b=Object(this._iterable),d=E(b);return this._scheduler.scheduleRecursive(0,c(a,d,this._fn))},b}(mc),Fc=Math.pow(2,53)-1;z.prototype[Ea]=function(){return new A(this._s)},A.prototype[Ea]=function(){return this},A.prototype.next=function(){return this._i<this._l?{done:!1,value:this._s.charAt(this._i++)}:Fa},B.prototype[Ea]=function(){return new C(this._a)},C.prototype[Ea]=function(){return this},C.prototype.next=function(){return this._i<this._l?{done:!1,value:this._a[this._i++]}:Fa};var Gc=lc.from=function(a,b,c,d){if(null==a)throw new Error("iterable cannot be null.");if(b&&!ka(b))throw new Error("mapFn when provided must be a function");if(b)var e=Ia(b,c,2);return Jb(d)||(d=Pb),new Ec(a,e,d)},Hc=function(a){function b(b,c){this._args=b,this._scheduler=c,a.call(this)}function c(a,b){var c=b.length;return function(d,e){c>d?(a.onNext(b[d]),e(d+1)):a.onCompleted()}}return qb(b,a),b.prototype.subscribeCore=function(a){return this._scheduler.scheduleRecursive(0,c(a,this._args))},b}(mc),Ic=lc.fromArray=function(a,b){return Jb(b)||(b=Pb),new Hc(a,b)},Jc=function(a){function b(b,c,d,e,f){this._initialState=b,this._cndFn=c,this._itrFn=d,this._resFn=e,this._s=f,a.call(this)}function c(a,b){if(a.first)a.first=!1;else if(a.newState=ma(a.self._itrFn)(a.newState),a.newState===la)return a.o.onError(a.newState.e);var c=ma(a.self._cndFn)(a.newState);if(c===la)return a.o.onError(c.e);if(c){var d=ma(a.self._resFn)(a.newState);if(d===la)return a.o.onError(d.e);a.o.onNext(d),b(a)}else a.o.onCompleted()}return qb(b,a),b.prototype.subscribeCore=function(a){var b={o:a,self:this,first:!0,newState:this._initialState};return this._s.scheduleRecursive(b,c)},b}(mc);lc.generate=function(a,b,c,d,e){return Jb(e)||(e=Pb),new Jc(a,b,c,d,e)};var Kc=function(a){function b(){a.call(this)}return qb(b,a),b.prototype.subscribeCore=function(a){return xb},b}(mc),Lc=new Kc,Mc=lc.never=function(){return Lc};lc.of=function(){for(var a=arguments.length,b=new Array(a),c=0;a>c;c++)b[c]=arguments[c];return new Hc(b,Pb)},lc.ofWithScheduler=function(a){for(var b=arguments.length,c=new Array(b-1),d=1;b>d;d++)c[d-1]=arguments[d];return new Hc(c,a)};var Nc=function(a){function b(b,c){this._o=b,this._keys=Object.keys(b),this._scheduler=c,a.call(this)}function c(a,b,c){return function(d,e){if(d<c.length){var f=c[d];a.onNext([f,b[f]]),e(d+1)}else a.onCompleted()}}return qb(b,a),b.prototype.subscribeCore=function(a){return this._scheduler.scheduleRecursive(0,c(a,this._o,this._keys))},b}(mc);lc.pairs=function(a,b){return b||(b=Pb),new Nc(a,b)};var Oc=function(a){function b(b,c,d){this.start=b,this.rangeCount=c,this.scheduler=d,a.call(this)}function c(a,b,c){return function(d,e){b>d?(c.onNext(a+d),e(d+1)):c.onCompleted()}}return qb(b,a),b.prototype.subscribeCore=function(a){return this.scheduler.scheduleRecursive(0,c(this.start,this.rangeCount,a))},b}(mc);lc.range=function(a,b,c){return Jb(c)||(c=Pb),new Oc(a,b,c)};var Pc=function(a){function b(b,c,d){this.value=b,this.repeatCount=null==c?-1:c,this.scheduler=d,a.call(this)}return qb(b,a),b.prototype.subscribeCore=function(a){var b=new I(a,this);return b.run()},b}(mc);I.prototype.run=function(){function a(a,d){return(-1===a||a>0)&&(b.onNext(c),a>0&&a--),0===a?b.onCompleted():void d(a)}var b=this.observer,c=this.parent.value;return this.parent.scheduler.scheduleRecursive(this.parent.repeatCount,a)},lc.repeat=function(a,b,c){return Jb(c)||(c=Pb),new Pc(a,b,c)};var Qc=function(a){function b(b,c){this._value=b,this._scheduler=c,a.call(this)}function c(a,b){var c=b[0],d=b[1];return d.onNext(c),d.onCompleted(),xb}return qb(b,a),b.prototype.subscribeCore=function(a){var b=[this._value,a];return this._scheduler===Nb?c(null,b):this._scheduler.schedule(b,c)},b}(mc),Rc=(lc["return"]=lc.just=function(a,b){return Jb(b)||(b=Nb),new Qc(a,b)},function(a){function b(b,c){this._error=b,this._scheduler=c,a.call(this)}function c(a,b){var c=b[0],d=b[1];return d.onError(c),xb}return qb(b,a),b.prototype.subscribeCore=function(a){var b=[this._error,a];return this._scheduler===Nb?c(null,b):this._scheduler.schedule(b,c)},b}(mc)),Sc=lc["throw"]=function(a,b){return Jb(b)||(b=Nb),new Rc(a,b)},Tc=function(a){function b(b,c){this._resFn=b,this._obsFn=c,a.call(this)}return qb(b,a),b.prototype.subscribeCore=function(a){var b=xb,c=ma(this._resFn)();if(c===la)return new Db(Sc(c.e).subscribe(a),b);c&&(b=c);var d=ma(this._obsFn)(c);return d===la?new Db(Sc(d.e).subscribe(a),b):new Db(d.subscribe(a),b)},b}(mc);lc.using=function(a,b){return new Tc(a,b)},fc.amb=function(a){var b=this;return new ae(function(c){function d(){f||(f=g,j.dispose())}function e(){f||(f=h,i.dispose())}var f,g="L",h="R",i=new Bb,j=new Bb;ja(a)&&(a=yc(a));var k=ec(function(a){d(),f===g&&c.onNext(a)},function(a){d(),f===g&&c.onError(a)},function(){d(),f===g&&c.onCompleted()}),l=ec(function(a){e(),f===h&&c.onNext(a)},function(a){e(),f===h&&c.onError(a)},function(){e(),f===h&&c.onCompleted()});return i.setDisposable(b.subscribe(k)),j.setDisposable(a.subscribe(l)),new Db(i,j)})},lc.amb=function(){var a,b=Mc();if(Array.isArray(arguments[0]))a=arguments[0];else{var c=arguments.length;a=new Array(a);for(var d=0;c>d;d++)a[d]=arguments[d]}for(var d=0,c=a.length;c>d;d++)b=J(b,a[d]);return b};var Uc=function(a){function b(b,c){this.source=b,this._fn=c,a.call(this)}return qb(b,a),b.prototype.subscribeCore=function(a){var b=new Bb,c=new Cb;return c.setDisposable(b),b.setDisposable(this.source.subscribe(new Vc(a,c,this._fn))),c},b}(mc),Vc=function(a){function b(b,c,d){this._o=b,this._s=c,this._fn=d,a.call(this)}return qb(b,a),b.prototype.next=function(a){this._o.onNext(a)},b.prototype.completed=function(){return this._o.onCompleted()},b.prototype.error=function(a){var b=ma(this._fn)(a);if(b===la)return this._o.onError(b.e);ja(b)&&(b=yc(b));var c=new Bb;this._s.setDisposable(c),c.setDisposable(b.subscribe(this._o))},b}(gc);fc["catch"]=function(a){return ka(a)?new Uc(this,a):Wc([this,a])};var Wc=lc["catch"]=function(){var a;if(Array.isArray(arguments[0]))a=arguments[0];else{var b=arguments.length;a=new Array(b);for(var c=0;b>c;c++)a[c]=arguments[c]}return uc(a).catchError()};fc.combineLatest=function(){for(var a=arguments.length,b=new Array(a),c=0;a>c;c++)b[c]=arguments[c];return Array.isArray(b[0])?b[0].unshift(this):b.unshift(this),Zc.apply(this,b)};var Xc=function(a){function b(b,c){this._params=b,this._cb=c,a.call(this)}return qb(b,a),b.prototype.subscribeCore=function(a){for(var b=this._params.length,c=new Array(b),d={hasValue:u(b,K),hasValueAll:!1,isDone:u(b,K),values:new Array(b)},e=0;b>e;e++){var f=this._params[e],g=new Bb;c[e]=g,ja(f)&&(f=yc(f)),g.setDisposable(f.subscribe(new Yc(a,e,this._cb,d)))}return new Eb(c)},b}(mc),Yc=function(a){function b(b,c,d,e){this._o=b,this._i=c,this._cb=d,this._state=e,a.call(this)}function c(a){return function(b,c){return c!==a}}return qb(b,a),b.prototype.next=function(a){if(this._state.values[this._i]=a,this._state.hasValue[this._i]=!0,this._state.hasValueAll||(this._state.hasValueAll=this._state.hasValue.every(ea))){var b=ma(this._cb).apply(null,this._state.values);if(b===la)return this._o.onError(b.e);this._o.onNext(b)}else this._state.isDone.filter(c(this._i)).every(ea)&&this._o.onCompleted()},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._state.isDone[this._i]=!0,this._state.isDone.every(ea)&&this._o.onCompleted()},b}(gc),Zc=lc.combineLatest=function(){for(var a=arguments.length,b=new Array(a),c=0;a>c;c++)b[c]=arguments[c];var d=ka(b[a-1])?b.pop():L;return Array.isArray(b[0])&&(b=b[0]),new Xc(b,d)};fc.concat=function(){for(var a=[],b=0,c=arguments.length;c>b;b++)a.push(arguments[b]);return a.unshift(this),ad.apply(null,a)};var $c=function(a){function b(b,c){this._s=b,this._fn=c,a.call(this)}return qb(b,a),b.prototype.next=function(a){this._s.o.onNext(a)},b.prototype.error=function(a){this._s.o.onError(a)},b.prototype.completed=function(){this._s.i++,this._fn(this._s)},b}(gc),_c=function(a){function b(b){this._sources=b,a.call(this)}function c(a,b){if(!a.disposable.isDisposed){if(a.i===a.sources.length)return a.o.onCompleted();var c=a.sources[a.i];ja(c)&&(c=yc(c));var d=new Bb;a.subscription.setDisposable(d),d.setDisposable(c.subscribe(new $c(a,b)))}}return qb(b,a),b.prototype.subscribeCore=function(a){var b=new Cb,d=wb(da),e={o:a,i:0,subscription:b,disposable:d,sources:this._sources},f=Nb.scheduleRecursive(e,c);return new Eb([b,d,f])},b}(mc),ad=lc.concat=function(){var a;if(Array.isArray(arguments[0]))a=arguments[0];else{a=new Array(arguments.length);for(var b=0,c=arguments.length;c>b;b++)a[b]=arguments[b]}return new _c(a)};fc.concatAll=function(){return this.merge(1)};var bd=function(a){function b(b,c){this.source=b,this.maxConcurrent=c,a.call(this)}return qb(b,a),b.prototype.subscribeCore=function(a){var b=new tb;return b.add(this.source.subscribe(new cd(a,this.maxConcurrent,b))),b},b}(mc),cd=function(a){function b(b,c,d){this.o=b,this.max=c,this.g=d,this.done=!1,this.q=[],this.activeCount=0,a.call(this)}function c(b,c){this.parent=b,this.sad=c,a.call(this)}return qb(b,a),b.prototype.handleSubscribe=function(a){var b=new Bb;this.g.add(b),ja(a)&&(a=yc(a)),b.setDisposable(a.subscribe(new c(this,b)))},b.prototype.next=function(a){this.activeCount<this.max?(this.activeCount++,this.handleSubscribe(a)):this.q.push(a)},b.prototype.error=function(a){this.o.onError(a)},b.prototype.completed=function(){this.done=!0,0===this.activeCount&&this.o.onCompleted()},qb(c,a),c.prototype.next=function(a){this.parent.o.onNext(a)},c.prototype.error=function(a){this.parent.o.onError(a)},c.prototype.completed=function(){this.parent.g.remove(this.sad),this.parent.q.length>0?this.parent.handleSubscribe(this.parent.q.shift()):(this.parent.activeCount--,this.parent.done&&0===this.parent.activeCount&&this.parent.o.onCompleted())},b}(gc);fc.merge=function(a){return"number"!=typeof a?dd(this,a):new bd(this,a)};var dd=lc.merge=function(){var a,b,c=[],d=arguments.length;if(arguments[0])if(Jb(arguments[0]))for(a=arguments[0],b=1;d>b;b++)c.push(arguments[b]);else for(a=Nb,b=0;d>b;b++)c.push(arguments[b]);else for(a=Nb,b=1;d>b;b++)c.push(arguments[b]);return Array.isArray(c[0])&&(c=c[0]),H(a,c).mergeAll()},ed=function(a){function b(b){this.source=b,a.call(this)}return qb(b,a),b.prototype.subscribeCore=function(a){var b=new tb,c=new Bb;return b.add(c),c.setDisposable(this.source.subscribe(new fd(a,b))),b},b}(mc),fd=function(a){function b(b,c){this.o=b,this.g=c,this.done=!1,a.call(this)}function c(b,c){this.parent=b,this.sad=c,a.call(this)}return qb(b,a),b.prototype.next=function(a){var b=new Bb;this.g.add(b),ja(a)&&(a=yc(a)),b.setDisposable(a.subscribe(new c(this,b)))},b.prototype.error=function(a){this.o.onError(a)},b.prototype.completed=function(){this.done=!0,1===this.g.length&&this.o.onCompleted()},qb(c,a),c.prototype.next=function(a){this.parent.o.onNext(a)},c.prototype.error=function(a){this.parent.o.onError(a)},c.prototype.completed=function(){this.parent.g.remove(this.sad),this.parent.done&&1===this.parent.g.length&&this.parent.o.onCompleted()},b}(gc);fc.mergeAll=function(){return new ed(this)};var gd=ca.CompositeError=function(a){this.innerErrors=a,this.message="This contains multiple errors. Check the innerErrors",Error.call(this)};gd.prototype=Object.create(Error.prototype),gd.prototype.name="CompositeError";var hd=function(a){function b(b){this.source=b,a.call(this)}return qb(b,a),b.prototype.subscribeCore=function(a){var b=new tb,c=new Bb,d={isStopped:!1,errors:[],o:a};return b.add(c),c.setDisposable(this.source.subscribe(new id(b,d))),b},b}(mc),id=function(a){function b(b,c){this._group=b,this._state=c,a.call(this)}function c(a,b){0===b.length?a.onCompleted():1===b.length?a.onError(b[0]):a.onError(new gd(b))}function d(b,c,d){this._inner=b,this._group=c,this._state=d,a.call(this)}return qb(b,a),b.prototype.next=function(a){var b=new Bb;this._group.add(b),ja(a)&&(a=yc(a)),b.setDisposable(a.subscribe(new d(b,this._group,this._state)))},b.prototype.error=function(a){this._state.errors.push(a),this._state.isStopped=!0,1===this._group.length&&c(this._state.o,this._state.errors)},b.prototype.completed=function(){this._state.isStopped=!0,1===this._group.length&&c(this._state.o,this._state.errors)},qb(d,a),d.prototype.next=function(a){this._state.o.onNext(a)},d.prototype.error=function(a){this._state.errors.push(a),this._group.remove(this._inner),this._state.isStopped&&1===this._group.length&&c(this._state.o,this._state.errors)},d.prototype.completed=function(){this._group.remove(this._inner),this._state.isStopped&&1===this._group.length&&c(this._state.o,this._state.errors)},b}(gc);lc.mergeDelayError=function(){var a;if(Array.isArray(arguments[0]))a=arguments[0];else{var b=arguments.length;a=new Array(b);for(var c=0;b>c;c++)a[c]=arguments[c]}var d=H(null,a);return new hd(d)},fc.onErrorResumeNext=function(a){if(!a)throw new Error("Second observable is required");return ld([this,a])};var jd=function(a){function b(b){this.sources=b,a.call(this)}function c(a,b){if(a.pos<a.sources.length){var c=a.sources[a.pos++];ja(c)&&(c=yc(c));var d=new Bb;a.subscription.setDisposable(d),d.setDisposable(c.subscribe(new kd(a,b)))}else a.o.onCompleted()}return qb(b,a),b.prototype.subscribeCore=function(a){var b=new Cb,d={pos:0,subscription:b,o:a,sources:this.sources},e=Nb.scheduleRecursive(d,c);return new Db(b,e)},b}(mc),kd=function(a){function b(b,c){this._state=b,this._recurse=c,a.call(this)}return qb(b,a),b.prototype.next=function(a){this._state.o.onNext(a)},b.prototype.error=function(){this._recurse(this._state)},b.prototype.completed=function(){this._recurse(this._state)},b}(gc),ld=lc.onErrorResumeNext=function(){var a=[];if(Array.isArray(arguments[0]))a=arguments[0];else{var b=arguments.length;a=new Array(b);for(var c=0;b>c;c++)a[c]=arguments[c]}return new jd(a)},md=function(a){function b(b,c){this._s=b,this._o=ja(c)?yc(c):c,this._open=!1,a.call(this)}return qb(b,a),b.prototype.subscribeCore=function(a){var b=new Bb;b.setDisposable(this._s.subscribe(new nd(a,this))),ja(this._o)&&(this._o=yc(this._o));var c=new Bb;return c.setDisposable(this._o.subscribe(new od(a,this,c))),new Db(b,c)},b}(mc),nd=function(a){function b(b,c){this._o=b,this._p=c,a.call(this)}return qb(b,a),b.prototype.next=function(a){this._p._open&&this._o.onNext(a)},b.prototype.error=function(a){this._o.onError(a)},b.prototype.onCompleted=function(){this._p._open&&this._o.onCompleted()},b}(gc),od=function(a){function b(b,c,d){this._o=b,this._p=c,this._r=d,a.call(this)}return qb(b,a),b.prototype.next=function(){this._p._open=!0,this._r.dispose()},b.prototype.error=function(a){this._o.onError(a)},b.prototype.onCompleted=function(){this._r.dispose()},b}(gc);fc.skipUntil=function(a){return new md(this,a)};var pd=function(a){function b(b){this.source=b,a.call(this)}function c(a,b){this.o=a,this.inner=b,this.stopped=!1,this.latest=0,this.hasLatest=!1,gc.call(this)}function d(a,b){this.parent=a,this.id=b,gc.call(this)}return qb(b,a),b.prototype.subscribeCore=function(a){var b=new Cb,d=this.source.subscribe(new c(a,b));return new Db(d,b)},qb(c,gc),c.prototype.next=function(a){var b=new Bb,c=++this.latest;this.hasLatest=!0,this.inner.setDisposable(b),ja(a)&&(a=yc(a)),b.setDisposable(a.subscribe(new d(this,c)))},c.prototype.error=function(a){this.o.onError(a)},c.prototype.completed=function(){this.stopped=!0,!this.hasLatest&&this.o.onCompleted()},qb(d,gc),d.prototype.next=function(a){this.parent.latest===this.id&&this.parent.o.onNext(a)},d.prototype.error=function(a){this.parent.latest===this.id&&this.parent.o.onError(a)},d.prototype.completed=function(){this.parent.latest===this.id&&(this.parent.hasLatest=!1,this.parent.stopped&&this.parent.o.onCompleted())},b}(mc);fc["switch"]=fc.switchLatest=function(){return new pd(this)};var qd=function(a){function b(b,c){this.source=b,this.other=ja(c)?yc(c):c,a.call(this)}return qb(b,a),b.prototype.subscribeCore=function(a){return new Db(this.source.subscribe(a),this.other.subscribe(new rd(a)))},b}(mc),rd=function(a){function b(b){this._o=b,a.call(this)}return qb(b,a),b.prototype.next=function(){this._o.onCompleted()},b.prototype.error=function(a){this._o.onError(a)},b.prototype.onCompleted=da,b}(gc);fc.takeUntil=function(a){return new qd(this,a)};var sd=function(a){function b(b,c,d){this._s=b,this._ss=c,this._cb=d,a.call(this)}return qb(b,a),b.prototype.subscribeCore=function(a){for(var b=this._ss.length,c={hasValue:u(b,K),hasValueAll:!1,values:new Array(b)},d=this._ss.length,e=new Array(d+1),f=0;d>f;f++){var g=this._ss[f],h=new Bb;ja(g)&&(g=yc(g)),h.setDisposable(g.subscribe(new td(a,f,c))),e[f]=h}var i=new Bb;return i.setDisposable(this._s.subscribe(new ud(a,this._cb,c))),e[d]=i,new Eb(e)},b}(mc),td=function(a){function b(b,c,d){this._o=b,this._i=c,this._state=d,a.call(this)}return qb(b,a),b.prototype.next=function(a){this._state.values[this._i]=a,this._state.hasValue[this._i]=!0,this._state.hasValueAll=this._state.hasValue.every(ea)},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=da,b}(gc),ud=function(a){function b(b,c,d){this._o=b,this._cb=c,this._state=d,a.call(this)}return qb(b,a),b.prototype.next=function(a){var b=[a].concat(this._state.values);if(this._state.hasValueAll){var c=ma(this._cb).apply(null,b);return c===la?this._o.onError(c.e):void this._o.onNext(c)}},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onCompleted()},b}(gc);fc.withLatestFrom=function(){if(0===arguments.length)throw new Error("invalid arguments");for(var a=arguments.length,b=new Array(a),c=0;a>c;c++)b[c]=arguments[c];var d=ka(b[a-1])?b.pop():L;return Array.isArray(b[0])&&(b=b[0]),new sd(this,b,d)};var vd=function(a){function b(b,c){this._s=b,this._cb=c,a.call(this)}return qb(b,a),b.prototype.subscribeCore=function(a){for(var b=this._s.length,c=new Array(b),d=u(b,K),e=u(b,M),f=0;b>f;f++){var g=this._s[f],h=new Bb;c[f]=h,ja(g)&&(g=yc(g)),h.setDisposable(g.subscribe(new wd(a,f,this,e,d)))}return new Eb(c)},b}(mc),wd=function(a){function b(b,c,d,e,f){this._o=b,this._i=c,this._p=d,this._q=e,this._d=f,a.call(this)}function c(a){return a.length>0}function d(a){return a.shift()}function e(a){return function(b,c){return c!==a}}return qb(b,a),b.prototype.next=function(a){if(this._q[this._i].push(a),this._q.every(c)){var b=this._q.map(d),f=ma(this._p._cb).apply(null,b);if(f===la)return this._o.onError(f.e);this._o.onNext(f)}else this._d.filter(e(this._i)).every(ea)&&this._o.onCompleted()},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._d[this._i]=!0,this._d.every(ea)&&this._o.onCompleted()},b}(gc);fc.zip=function(){if(0===arguments.length)throw new Error("invalid arguments");for(var a=arguments.length,b=new Array(a),c=0;a>c;c++)b[c]=arguments[c];var d=ka(b[a-1])?b.pop():L;Array.isArray(b[0])&&(b=b[0]);var e=this;return b.unshift(e),new vd(b,d)},lc.zip=function(){for(var a=arguments.length,b=new Array(a),c=0;a>c;c++)b[c]=arguments[c];Array.isArray(b[0])&&(b=ka(b[1])?b[0].concat(b[1]):b[0]);var d=b.shift();return d.zip.apply(d,b)};var xd=function(a){function b(b,c){this.sources=b,this._cb=c,a.call(this)}return qb(b,a),b.prototype.subscribeCore=function(a){for(var b=this.sources,c=b.length,d=new Array(c),e={q:u(c,M),done:u(c,K),cb:this._cb,o:a},f=0;c>f;f++)!function(a){var c=b[a],f=new Bb;(Ha(c)||Ga(c))&&(c=Gc(c)),d[a]=f,f.setDisposable(c.subscribe(new yd(e,a)))}(f);return new Eb(d)},b}(mc),yd=function(a){function b(b,c){this._s=b,this._i=c,a.call(this)}function c(a){return a.length>0}function d(a){return a.shift()}function e(a){return function(b,c){return c!==a}}return qb(b,a),b.prototype.next=function(a){if(this._s.q[this._i].push(a),this._s.q.every(c)){var b=this._s.q.map(d),f=ma(this._s.cb).apply(null,b);if(f===la)return this._s.o.onError(f.e);this._s.o.onNext(f)}else this._s.done.filter(e(this._i)).every(ea)&&this._s.o.onCompleted()},b.prototype.error=function(a){this._s.o.onError(a)},b.prototype.completed=function(){this._s.done[this._i]=!0,this._s.done.every(ea)&&this._s.o.onCompleted()},b}(gc);fc.zipIterable=function(){if(0===arguments.length)throw new Error("invalid arguments");for(var a=arguments.length,b=new Array(a),c=0;a>c;c++)b[c]=arguments[c];var d=ka(b[a-1])?b.pop():L,e=this;return b.unshift(e),new xd(b,d)},fc.asObservable=function(){return new ae(N(this),this)},fc.bufferWithCount=fc.bufferCount=function(a,b){return"number"!=typeof b&&(b=a),this.windowWithCount(a,b).flatMap(O).filter(P)};var zd=function(a){function b(b){this.source=b,a.call(this)}return qb(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new Ad(a))},b}(mc),Ad=function(a){function b(b){this._o=b,a.call(this)}return qb(b,a),b.prototype.next=function(a){a.accept(this._o)},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onCompleted()},b}(gc);fc.dematerialize=function(){return new zd(this)};var Bd=function(a){function b(b,c,d){this.source=b,this.keyFn=c,this.comparer=d,a.call(this)}return qb(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new Cd(a,this.keyFn,this.comparer))},b}(mc),Cd=function(a){function b(b,c,d){this.o=b,this.keyFn=c,this.comparer=d,this.hasCurrentKey=!1,this.currentKey=null,a.call(this)}return qb(b,a),b.prototype.next=function(a){var b,c=a;return ka(this.keyFn)&&(c=ma(this.keyFn)(a),c===la)?this.o.onError(c.e):this.hasCurrentKey&&(b=ma(this.comparer)(this.currentKey,c),b===la)?this.o.onError(b.e):void(this.hasCurrentKey&&b||(this.hasCurrentKey=!0,this.currentKey=c,this.o.onNext(a)))},b.prototype.error=function(a){this.o.onError(a)},b.prototype.completed=function(){this.o.onCompleted()},b}(gc);fc.distinctUntilChanged=function(a,b){return b||(b=ga),new Bd(this,a,b)};var Dd=function(a){function b(b,c,d,e){this.source=b,this._oN=c,this._oE=d,this._oC=e,a.call(this)}function c(a,b){this.o=a,this.t=!b._oN||ka(b._oN)?ec(b._oN||da,b._oE||da,b._oC||da):b._oN,this.isStopped=!1,gc.call(this)}return qb(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new c(a,this))},qb(c,gc),c.prototype.next=function(a){var b=ma(this.t.onNext).call(this.t,a);b===la&&this.o.onError(b.e),this.o.onNext(a)},c.prototype.error=function(a){var b=ma(this.t.onError).call(this.t,a);return b===la?this.o.onError(b.e):void this.o.onError(a)},c.prototype.completed=function(){var a=ma(this.t.onCompleted).call(this.t);return a===la?this.o.onError(a.e):void this.o.onCompleted()},b}(mc);fc["do"]=fc.tap=fc.doAction=function(a,b,c){return new Dd(this,a,b,c)},fc.doOnNext=fc.tapOnNext=function(a,b){return this.tap("undefined"!=typeof b?function(c){a.call(b,c)}:a)},fc.doOnError=fc.tapOnError=function(a,b){return this.tap(da,"undefined"!=typeof b?function(c){a.call(b,c)}:a)},fc.doOnCompleted=fc.tapOnCompleted=function(a,b){return this.tap(da,null,"undefined"!=typeof b?function(){a.call(b)}:a)};var Ed=function(a){function b(b,c,d){this.source=b,this._fn=Ia(c,d,0),a.call(this)}function c(a,b){this.isDisposed=!1,this._s=a,this._fn=b}return qb(b,a),b.prototype.subscribeCore=function(a){var b=ma(this.source.subscribe).call(this.source,a);return b===la&&(this._fn(),e(b.e)),new c(b,this._fn)},c.prototype.dispose=function(){if(!this.isDisposed){var a=ma(this._s.dispose).call(this._s);this._fn(),a===la&&e(a.e)}},b}(mc);fc["finally"]=function(a,b){return new Ed(this,a,b)};var Fd=function(a){function b(b){this.source=b,a.call(this)}function c(a){this.o=a,this.isStopped=!1}return qb(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new c(a))},c.prototype.onNext=da,c.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.o.onError(a))},c.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.o.onCompleted())},c.prototype.dispose=function(){this.isStopped=!0},c.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.observer.onError(a),!0)},b}(mc);fc.ignoreElements=function(){return new Fd(this)};var Gd=function(a){function b(b,c){this.source=b,a.call(this)}return qb(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new Hd(a))},b}(mc),Hd=function(a){function b(b){this._o=b,a.call(this)}return qb(b,a),b.prototype.next=function(a){this._o.onNext(ac(a))},b.prototype.error=function(a){this._o.onNext(bc(a)),this._o.onCompleted()},b.prototype.completed=function(){this._o.onNext(cc()),this._o.onCompleted()},b}(gc);fc.materialize=function(){return new Gd(this)},fc.repeat=function(a){return sc(this,a).concat()},fc.retry=function(a){return sc(this,a).catchError()};var Id=function(a){function b(a){return{isDisposed:!1,dispose:function(){this.isDisposed||(this.isDisposed=!0,a.isDisposed=!0)}}}function c(b,c){this.source=b,this._notifier=c,a.call(this)}return qb(c,a),c.prototype.subscribeCore=function(a){var c,d=new de,e=new de,f=this._notifier(d),g=f.subscribe(e),h=this.source["@@iterator"](),i={isDisposed:!1},j=new Cb,k=Pb.scheduleRecursive(null,function(b,f){if(!i.isDisposed){var g=h.next();if(g.done)return void(c?a.onError(c):a.onCompleted());var k=g.value;ja(k)&&(k=yc(k));var l=new Bb,m=new Bb;j.setDisposable(new Db(m,l)),l.setDisposable(k.subscribe(function(b){a.onNext(b)},function(b){m.setDisposable(e.subscribe(f,function(b){a.onError(b)},function(){a.onCompleted()})),d.onNext(b),l.dispose()},function(){a.onCompleted()}))}});return new Eb([g,j,k,b(i)])},c}(mc);fc.retryWhen=function(a){return new Id(Q(this),a)};var Jd=function(a){function b(a){return{isDisposed:!1,dispose:function(){this.isDisposed||(this.isDisposed=!0,a.isDisposed=!0)}}}function c(b,c){this.source=b,this._notifier=c,
a.call(this)}return qb(c,a),c.prototype.subscribeCore=function(a){var c,d=new de,e=new de,f=this._notifier(d),g=f.subscribe(e),h=this.source["@@iterator"](),i={isDisposed:!1},j=new Cb,k=Pb.scheduleRecursive(null,function(b,f){if(!i.isDisposed){var g=h.next();if(g.done)return void(c?a.onError(c):a.onCompleted());var k=g.value;ja(k)&&(k=yc(k));var l=new Bb,m=new Bb;j.setDisposable(new Db(m,l)),l.setDisposable(k.subscribe(function(b){a.onNext(b)},function(b){a.onError(b)},function(){m.setDisposable(e.subscribe(f,function(b){a.onError(b)},function(){a.onCompleted()})),d.onNext(null),l.dispose()}))}});return new Eb([g,j,k,b(i)])},c}(mc);fc.repeatWhen=function(a){return new Jd(Q(this),a)};var Kd=function(a){function b(b,c,d,e){this.source=b,this.accumulator=c,this.hasSeed=d,this.seed=e,a.call(this)}return qb(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new Ld(a,this))},b}(mc),Ld=function(a){function b(b,c){this._o=b,this._p=c,this._fn=c.accumulator,this._hs=c.hasSeed,this._s=c.seed,this._ha=!1,this._a=null,this._hv=!1,this._i=0,a.call(this)}return qb(b,a),b.prototype.next=function(a){return!this._hv&&(this._hv=!0),this._ha?this._a=ma(this._fn)(this._a,a,this._i,this._p):(this._a=this._hs?ma(this._fn)(this._s,a,this._i,this._p):a,this._ha=!0),this._a===la?this._o.onError(this._a.e):(this._o.onNext(this._a),void this._i++)},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){!this._hv&&this._hs&&this._o.onNext(this._s),this._o.onCompleted()},b}(gc);fc.scan=function(){var a,b=!1,c=arguments[0];return 2===arguments.length&&(b=!0,a=arguments[1]),new Kd(this,c,b,a)};var Md=function(a){function b(b,c){this.source=b,this._c=c,a.call(this)}return qb(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new Nd(a,this._c))},b}(mc),Nd=function(a){function b(b,c){this._o=b,this._c=c,this._q=[],a.call(this)}return qb(b,a),b.prototype.next=function(a){this._q.push(a),this._q.length>this._c&&this._o.onNext(this._q.shift())},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onCompleted()},b}(gc);fc.skipLast=function(a){if(0>a)throw new Aa;return new Md(this,a)},fc.startWith=function(){var a,b=0;arguments.length&&Jb(arguments[0])?(a=arguments[0],b=1):a=Nb;for(var c=[],d=b,e=arguments.length;e>d;d++)c.push(arguments[d]);return ad.apply(null,[Ic(c,a),this])};var Od=function(a){function b(b,c){this._o=b,this._c=c,this._q=[],a.call(this)}return qb(b,a),b.prototype.next=function(a){this._q.push(a),this._q.length>this._c&&this._q.shift()},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){for(;this._q.length>0;)this._o.onNext(this._q.shift());this._o.onCompleted()},b}(gc);fc.takeLast=function(a){if(0>a)throw new Aa;var b=this;return new ae(function(c){return b.subscribe(new Od(c,a))},b)};var Pd=function(a){function b(b,c){this._o=b,this._c=c,this._q=[],a.call(this)}return qb(b,a),b.prototype.next=function(a){this._q.push(a),this._q.length>this._c&&this._q.shift()},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onNext(this._q),this._o.onCompleted()},b}(gc);fc.takeLastBuffer=function(a){if(0>a)throw new Aa;var b=this;return new ae(function(c){return b.subscribe(new Pd(c,a))},b)},fc.windowWithCount=fc.windowCount=function(a,b){var c=this;if(+a||(a=0),Math.abs(a)===1/0&&(a=0),0>=a)throw new Aa;if(null==b&&(b=a),+b||(b=0),Math.abs(b)===1/0&&(b=0),0>=b)throw new Aa;return new ae(function(d){function e(){var a=new de;i.push(a),d.onNext(sb(a,g))}var f=new Bb,g=new Fb(f),h=0,i=[];return e(),f.setDisposable(c.subscribe(function(c){for(var d=0,f=i.length;f>d;d++)i[d].onNext(c);var g=h-a+1;g>=0&&g%b===0&&i.shift().onCompleted(),++h%b===0&&e()},function(a){for(;i.length>0;)i.shift().onError(a);d.onError(a)},function(){for(;i.length>0;)i.shift().onCompleted();d.onCompleted()})),g},c)},fc.flatMapConcat=fc.concatMap=function(a,b,c){return new nc(this,a,b,c).merge(1)},fc.concatMapObserver=fc.selectConcatObserver=function(a,b,c,d){var e=this,f=Ia(a,d,2),g=Ia(b,d,1),h=Ia(c,d,0);return new ae(function(a){var b=0;return e.subscribe(function(c){var d;try{d=f(c,b++)}catch(e){return void a.onError(e)}ja(d)&&(d=yc(d)),a.onNext(d)},function(b){var c;try{c=g(b)}catch(d){return void a.onError(d)}ja(c)&&(c=yc(c)),a.onNext(c),a.onCompleted()},function(){var b;try{b=h()}catch(c){return void a.onError(c)}ja(b)&&(b=yc(b)),a.onNext(b),a.onCompleted()})},this).concatAll()};var Qd=function(a){function b(b,c){this._o=b,this._d=c,this._f=!1,a.call(this)}return qb(b,a),b.prototype.next=function(a){this._f=!0,this._o.onNext(a)},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){!this._f&&this._o.onNext(this._d),this._o.onCompleted()},b}(gc);fc.defaultIfEmpty=function(b){var c=this;return b===a&&(b=null),new ae(function(a){return c.subscribe(new Qd(a,b))},c)},S.prototype.push=function(a){var b=-1===R(this.set,a,this.comparer);return b&&this.set.push(a),b};var Rd=function(a){function b(b,c,d){this.source=b,this._keyFn=c,this._cmpFn=d,a.call(this)}return qb(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new Sd(a,this._keyFn,this._cmpFn))},b}(mc),Sd=function(a){function b(b,c,d){this._o=b,this._keyFn=c,this._h=new S(d),a.call(this)}return qb(b,a),b.prototype.next=function(a){var b=a;return ka(this._keyFn)&&(b=ma(this._keyFn)(a),b===la)?this._o.onError(b.e):void(this._h.push(b)&&this._o.onNext(a))},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onCompleted()},b}(gc);fc.distinct=function(a,b){return b||(b=ga),new Rd(this,a,b)};var Td=function(a){function b(b,c,d){this.source=b,this.selector=Ia(c,d,3),a.call(this)}function c(a,b){return function(c,d,e){return a.call(this,b.selector(c,d,e),d,e)}}function d(a,b,c){this.o=a,this.selector=b,this.source=c,this.i=0,gc.call(this)}return qb(b,a),b.prototype.internalMap=function(a,d){return new b(this.source,c(a,this),d)},b.prototype.subscribeCore=function(a){return this.source.subscribe(new d(a,this.selector,this))},qb(d,gc),d.prototype.next=function(a){var b=ma(this.selector)(a,this.i++,this.source);return b===la?this.o.onError(b.e):void this.o.onNext(b)},d.prototype.error=function(a){this.o.onError(a)},d.prototype.completed=function(){this.o.onCompleted()},b}(mc);fc.map=fc.select=function(a,b){var c="function"==typeof a?a:function(){return a};return this instanceof Td?this.internalMap(c,b):new Td(this,c,b)},fc.pluck=function(){var a=arguments.length,b=new Array(a);if(0===a)throw new Error("List of properties cannot be empty.");for(var c=0;a>c;c++)b[c]=arguments[c];return this.map(T(b,a))},fc.flatMap=fc.selectMany=fc.mergeMap=function(a,b,c){return new nc(this,a,b,c).mergeAll()},fc.flatMapObserver=fc.selectManyObserver=function(a,b,c,d){var e=this;return new ae(function(f){var g=0;return e.subscribe(function(b){var c;try{c=a.call(d,b,g++)}catch(e){return void f.onError(e)}ja(c)&&(c=yc(c)),f.onNext(c)},function(a){var c;try{c=b.call(d,a)}catch(e){return void f.onError(e)}ja(c)&&(c=yc(c)),f.onNext(c),f.onCompleted()},function(){var a;try{a=c.call(d)}catch(b){return void f.onError(b)}ja(a)&&(a=yc(a)),f.onNext(a),f.onCompleted()})},e).mergeAll()},fc.flatMapLatest=fc.switchMap=function(a,b,c){return new nc(this,a,b,c).switchLatest()};var Ud=function(a){function b(b,c){this.source=b,this._count=c,a.call(this)}function c(a,b){this._o=a,this._r=b,gc.call(this)}return qb(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new c(a,this._count))},qb(c,gc),c.prototype.next=function(a){this._r<=0?this._o.onNext(a):this._r--},c.prototype.error=function(a){this._o.onError(a)},c.prototype.completed=function(){this._o.onCompleted()},b}(mc);fc.skip=function(a){if(0>a)throw new Aa;return new Ud(this,a)};var Vd=function(a){function b(b,c){this.source=b,this._fn=c,a.call(this)}return qb(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new Wd(a,this))},b}(mc),Wd=function(a){function b(b,c){this._o=b,this._p=c,this._i=0,this._r=!1,a.call(this)}return qb(b,a),b.prototype.next=function(a){if(!this._r){var b=ma(this._p._fn)(a,this._i++,this._p);if(b===la)return this._o.onError(b.e);this._r=!b}this._r&&this._o.onNext(a)},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onCompleted()},b}(gc);fc.skipWhile=function(a,b){var c=Ia(a,b,3);return new Vd(this,c)};var Xd=function(a){function b(b,c){this.source=b,this._count=c,a.call(this)}function c(a,b){this._o=a,this._c=b,this._r=b,gc.call(this)}return qb(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new c(a,this._count))},qb(c,gc),c.prototype.next=function(a){this._r-->0&&(this._o.onNext(a),this._r<=0&&this._o.onCompleted())},c.prototype.error=function(a){this._o.onError(a)},c.prototype.completed=function(){this._o.onCompleted()},b}(mc);fc.take=function(a,b){if(0>a)throw new Aa;return 0===a?Dc(b):new Xd(this,a)};var Yd=function(a){function b(b,c){this.source=b,this._fn=c,a.call(this)}return qb(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new Zd(a,this))},b}(mc),Zd=function(a){function b(b,c){this._o=b,this._p=c,this._i=0,this._r=!0,a.call(this)}return qb(b,a),b.prototype.next=function(a){return this._r&&(this._r=ma(this._p._fn)(a,this._i++,this._p),this._r===la)?this._o.onError(this._r.e):void(this._r?this._o.onNext(a):this._o.onCompleted())},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onCompleted()},b}(gc);fc.takeWhile=function(a,b){var c=Ia(a,b,3);return new Yd(this,c)};var $d=function(a){function b(b,c,d){this.source=b,this.predicate=Ia(c,d,3),a.call(this)}function c(a,b){return function(c,d,e){return b.predicate(c,d,e)&&a.call(this,c,d,e)}}function d(a,b,c){this.o=a,this.predicate=b,this.source=c,this.i=0,gc.call(this)}return qb(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new d(a,this.predicate,this))},b.prototype.internalFilter=function(a,d){return new b(this.source,c(a,this),d)},qb(d,gc),d.prototype.next=function(a){var b=ma(this.predicate)(a,this.i++,this.source);return b===la?this.o.onError(b.e):void(b&&this.o.onNext(a))},d.prototype.error=function(a){this.o.onError(a)},d.prototype.completed=function(){this.o.onCompleted()},b}(mc);fc.filter=fc.where=function(a,b){return this instanceof $d?this.internalFilter(a,b):new $d(this,a,b)};var _d=function(a){function b(b,c){this._o=b,this._xform=c,a.call(this)}return qb(b,a),b.prototype.next=function(a){var b=ma(this._xform["@@transducer/step"]).call(this._xform,this._o,a);b===la&&this._o.onError(b.e)},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._xform["@@transducer/result"](this._o)},b}(gc);fc.transduce=function(a){var b=this;return new ae(function(c){var d=a(U(c));return b.subscribe(new _d(c,d))},b)};var ae=ca.AnonymousObservable=function(a){function b(a){return a&&ka(a.dispose)?a:ka(a)?wb(a):xb}function c(a,c){var d=c[0],f=c[1],g=ma(f.__subscribe).call(f,d);g!==la||d.fail(la.e)||e(la.e),d.setDisposable(b(g))}function d(b,c){this.source=c,this.__subscribe=b,a.call(this)}return qb(d,a),d.prototype._subscribe=function(a){var b=new be(a),d=[b,this];return Pb.scheduleRequired()?Pb.schedule(d,c):c(null,d),b},d}(lc),be=function(a){function b(b){a.call(this),this.observer=b,this.m=new Bb}qb(b,a);var c=b.prototype;return c.next=function(a){var b=ma(this.observer.onNext).call(this.observer,a);b===la&&(this.dispose(),e(b.e))},c.error=function(a){var b=ma(this.observer.onError).call(this.observer,a);this.dispose(),b===la&&e(b.e)},c.completed=function(){var a=ma(this.observer.onCompleted).call(this.observer);this.dispose(),a===la&&e(a.e)},c.setDisposable=function(a){this.m.setDisposable(a)},c.getDisposable=function(){return this.m.getDisposable()},c.dispose=function(){a.prototype.dispose.call(this),this.m.dispose()},b}(gc),ce=function(a,b){this._s=a,this._o=b};ce.prototype.dispose=function(){if(!this._s.isDisposed&&null!==this._o){var a=this._s.observers.indexOf(this._o);this._s.observers.splice(a,1),this._o=null}};var de=ca.Subject=function(a){function b(){a.call(this),this.isDisposed=!1,this.isStopped=!1,this.observers=[],this.hasError=!1}return qb(b,a),rb(b.prototype,dc.prototype,{_subscribe:function(a){return zb(this),this.isStopped?this.hasError?(a.onError(this.error),xb):(a.onCompleted(),xb):(this.observers.push(a),new ce(this,a))},hasObservers:function(){return zb(this),this.observers.length>0},onCompleted:function(){if(zb(this),!this.isStopped){this.isStopped=!0;for(var a=0,b=c(this.observers),d=b.length;d>a;a++)b[a].onCompleted();this.observers.length=0}},onError:function(a){if(zb(this),!this.isStopped){this.isStopped=!0,this.error=a,this.hasError=!0;for(var b=0,d=c(this.observers),e=d.length;e>b;b++)d[b].onError(a);this.observers.length=0}},onNext:function(a){if(zb(this),!this.isStopped)for(var b=0,d=c(this.observers),e=d.length;e>b;b++)d[b].onNext(a)},dispose:function(){this.isDisposed=!0,this.observers=null}}),b.create=function(a,b){return new ee(a,b)},b}(lc),ee=(ca.AsyncSubject=function(a){function b(){a.call(this),this.isDisposed=!1,this.isStopped=!1,this.hasValue=!1,this.observers=[],this.hasError=!1}return qb(b,a),rb(b.prototype,dc.prototype,{_subscribe:function(a){return zb(this),this.isStopped?(this.hasError?a.onError(this.error):this.hasValue?(a.onNext(this.value),a.onCompleted()):a.onCompleted(),xb):(this.observers.push(a),new ce(this,a))},hasObservers:function(){return zb(this),this.observers.length>0},onCompleted:function(){var a,b;if(zb(this),!this.isStopped){this.isStopped=!0;var d=c(this.observers),b=d.length;if(this.hasValue)for(a=0;b>a;a++){var e=d[a];e.onNext(this.value),e.onCompleted()}else for(a=0;b>a;a++)d[a].onCompleted();this.observers.length=0}},onError:function(a){if(zb(this),!this.isStopped){this.isStopped=!0,this.hasError=!0,this.error=a;for(var b=0,d=c(this.observers),e=d.length;e>b;b++)d[b].onError(a);this.observers.length=0}},onNext:function(a){zb(this),this.isStopped||(this.value=a,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.error=null,this.value=null}}),b}(lc),ca.AnonymousSubject=function(a){function b(b,c){this.observer=b,this.observable=c,a.call(this)}return qb(b,a),rb(b.prototype,dc.prototype,{_subscribe:function(a){return this.observable.subscribe(a)},onCompleted:function(){this.observer.onCompleted()},onError:function(a){this.observer.onError(a)},onNext:function(a){this.observer.onNext(a)}}),b}(lc));"function"==typeof define&&"object"==typeof define.amd&&define.amd?(ba.Rx=ca,define(function(){return ca})):W&&X?_?(X.exports=ca).Rx=ca:W.Rx=ca:ba.Rx=ca;var fe=j()}).call(this);
//# sourceMappingURL=rx.compat.map